home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Tool Chest / Testing & Debugging / Mac OS Development Toolkit / Automation Essentials 2.3.0 / Host Automation Folder / VU External Tool libs / Arbitrator.vulib < prev    next >
Encoding:
Text File  |  1998-03-19  |  3.2 KB  |  87 lines  |  [TEXT/MPS ]

  1. #
  2. #    File:        Arbitrator.vulib
  3. #
  4. #    Contains:    The tool definition along with the high level tasks to access
  5. #                the tool's services
  6. #
  7. #    The basic rules of operation are:
  8. #        1) The list of names is a global variable that persists until the
  9. #            application is quit and re-launched.
  10. #        2) A specific name can occur only once in the list. 
  11. #        3) If a name exists, it is locked by definition. At the time it is
  12. #            locked, an object containing it is created and added to the list.
  13. #        4) If a name does not exist, it is unlocked by definition. When a 
  14. #            locked name is unlocked, its object is deleted from the list. 
  15. #        5) Trying to lock a locked name fails.
  16. #        6) Trying to unlock a name fails if it is not locked already
  17. #    
  18. #    Written by:    SBR from FileTool by P. Nagarajan
  19. #
  20. #    Copyright:    © 1993-1997 by Apple Computer, Inc., all rights reserved.
  21. #
  22. #    Change History (most recent first):
  23. #
  24. #
  25. #    1.0.0        01/29/97    JAS        Added 'vers' resources to library.
  26. #                                    These should always match tool version when tool is revved.
  27. #                01/29/97    JAS        Removed unsupported services
  28. #                11/03/94    SBR        Added ThreadedService support
  29. #                09/29/94    SBR        Built with LockName service
  30. #                03/26/93    NAGA    xxx put comment here xxx
  31. #
  32. #    To Do:
  33. #
  34.  
  35. tool Arbitrator s:'Arbi'
  36. begin
  37.     # Services specific to Arbitrator:
  38.     
  39.     # To lock a name
  40.  
  41.     Service    "LockID"( 'list', 'undefined', 'undefined'  ) return 'undefined';
  42.  
  43.     # first parameter is the 1-63 character name to lock as a semaphore 
  44.     # second parameter is Boolean: true means lock, false means unlock 
  45.     # third parameter is optional 1-63 character key string to lock/unlock the name
  46.     # return value is Boolean, true means success, false means failure
  47.     
  48.     
  49.     Service    "AutoDestruct"(  ) return 'undefined';
  50.  
  51.     # no parameters; always call this service asynchronously; activates when canceled;
  52.     #    unregisters all keys with its AutoDestructID (asynchronous job ID).
  53.     # return value is Boolean, true means success, false means failure
  54.     
  55.     
  56.     Service    "DumpIDs"(  ) return 'list';
  57.     
  58.     # no parameters; used for debugging.
  59.     # return value is list: 
  60.     #    { 'IDs', {semaphore...}, {semaphore2}, {semaphore1}}
  61.     
  62.     
  63.     
  64.     # Generic services:
  65.     
  66.     # To Echo a list after a number of ticks, in a new thread 
  67.     Service    "EchoThread"( 'undefined', 'integer', 'symbol', 'integer' ) return 'undefined';
  68.     # first parameter is the value or list of values to echo 
  69.     # second parameter is the number of ticks to pause before returning
  70.     # third parameter is Boolean: 
  71.     #        true means beep entering and leaving ProcessRequest()
  72.     #        false means do not 
  73.     # return value should be equal to first parameter except when:
  74.     #        symbol and descriptor parameters are turned into strings by VU
  75.     #        integers are sent to the tool as long or short based on VU version
  76.     #        longs are sent to the script as long or string based on VU version
  77.     
  78.     # To Echo a list after a number of ticks, in the RequestDispatcher thread 
  79.     Service    "EchoNoThread"( 'undefined', 'integer', 'symbol', 'integer' ) return 'undefined';
  80.     # same as Echo service except this one is non-threaded
  81.     
  82.     # To set the number of ticks given to WaitNextEvent() in the tool
  83.     # Only affects the tool when it is in the background
  84.     # returns the previous value
  85.     Service    "SetSleepTicks"( 'integer' ) return 'integer';
  86.     
  87. end;